#include "graph.h"
#include<bits/stdc++.h>
using namespace std;
/*
	void Inspect(int R);
	void Answer(int D, int A);
	void Move(int I, int V);
	int NumberOfRoads();
	int LastRoad();
	int Color();
*/
const int N=205,M=40005;
namespace Solve{
	#define pii pair<int,int> 
	#define fi first 
	#define se second  
	#define cmin(a,b) ((a)=min((a),(b)))
	int nw,ans[N],G[N][N],dep[N],st[N],top,fa[N],E[N][N],Edgetofa[N],Edgefromfa[N],vis[N],color[N],n,key[4];
	vector<int> unsureEdge[N];bool okunsureEdge[N][N];
	vector<pii> TreeEdge[N];
	int get_color(int edgeid){
		Move(edgeid,Color());
		int res=Color();
		Move(LastRoad(),res);
		return res;
	}
	void dfs(int lst,int f){
		int u=++n;fa[u]=f;dep[u]=dep[f]+1;
		int k=NumberOfRoads();  
		Edgetofa[u]=LastRoad();
		Edgefromfa[u]=lst;
		G[u][f]=G[f][u]=1;
		for(int i=1;i<=k;++i){
			if(i==Edgetofa[u])continue;
			Move(i,2);
			if(Color()==2){
				unsureEdge[u].push_back(i);
				Move(LastRoad(),2);
			}
			else {
				TreeEdge[u].push_back({i,n+1});
				E[u][n+1]=i;dfs(i,u);
			}
		}
		if(u!=1)Move(Edgetofa[u],2); 
	}
	void get_back(int gol){
		while(nw!=gol){
//			cerr<<"get_back"<<nw<<' '<<gol<<' '<<fa[nw]<<' '<<Edgetofa[nw]<<'\n';
			Move(Edgetofa[nw],Color());
			nw=fa[nw];
		}
//		cerr<<"OK OK get_back\n";
	}
	int lca(int u,int v){
		if(dep[u]<dep[v])swap(u,v);
		while(dep[u]^dep[v])u=fa[u];
		if(u==v)return u;
		while(fa[u]!=fa[v])
			u=fa[u],v=fa[v];
		return fa[u];
	}
	void get_to(int gol){
		int t=gol;
//		cerr<<"gol"<<gol<<'\n';
		while(gol^nw){
			st[++top]=Edgefromfa[gol];
			gol=fa[gol];
		}
		while(top)Move(st[top--],Color());
		nw=t;
	}
	void change_color(int u,int col){
		key[col]=u;
		get_to(u);
		Move(Edgetofa[u],col);
		nw=fa[u];
		get_back(1);
	}
	void Exchange_color(int u,int v,int colu,int colv){
//		cerr<<"EXchange :"<<u<<' '<<v<<'\n';
		key[colu]=u;
		key[colv]=v;		
		if(fa[v]==u){
			get_to(u);
//			cerr<<"fuck"<<u<<' '<<E[u][v]<<'\n';
			Move(E[u][v],colu);
			Move(Edgetofa[v],colv);
			return get_back(1);
		}
		get_to(u);
		Move(Edgetofa[u],colu);
		nw=fa[u];
		get_back(lca(u,v));
		get_to(v);
		Move(Edgetofa[v],colv);
		nw=fa[v];
		get_back(1);
	}
	void check(int u){
//		cerr<<"check"<<u<<'\n';
		for(int v:unsureEdge[u]){
			if(okunsureEdge[u][v])continue;
//			cerr<<"unsure "<<u<<' '<<v<<'\n';
			Move(v,Color());
			if(Color()!=2){
				int to=key[Color()];
//				cerr<<"Make_sure "<<u<<' '<<to<<'\n';
				G[u][to]=G[to][u]=1;
				okunsureEdge[u][v]=1;
			}
			Move(LastRoad(),Color());
		}
		for(auto v:TreeEdge[u]){
			Move(v.fi,Color());
			check(v.se);
		}
		if(u!=1)Move(Edgetofa[u],Color());
	}
	void check_Edge(){
		nw=1;
		for(int i=1;i+1<=n;i+=2){
			Exchange_color(i,i+1,1,3);
			check(1);
//			cerr<<"okokokok\n";
			if(!(n%2==0&&i==n-1))
				Exchange_color(i,i+1,2,2);
//			cerr<<"kokokoko\n";
		}
		if(n&1){
			change_color(n,1);
			check(1);
		}
	}
	void build_Tree(){
		memset(G,0x3f,sizeof G);
		for(int i=1;i<=200;++i)color[i]=1;
		dfs(0,0);
//		cerr<<"n:"<<n<<'\n';
//		for(int i=1;i<=n;++i)
//			cerr<<fa[i]<<' ';
//		cerr<<'\n';
//		for(int i=1;i<=n;++i)
//			cerr<<Edgetofa[i]<<' ';
//		cerr<<'\n';
	}
	void Floyd(){
		int cntedge=0;
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j){
				if(G[i][j]==1)
					++cntedge;
			}
		for(int k=1;k<=n;++k)
			for(int i=1;i<=n;++i)
				for(int j=1;j<=n;++j)
					cmin(G[i][j],G[i][k]+G[k][j]);
		for(int i=1;i<=n;++i)
			for(int j=i+1;j<=n;++j){
				//if(G[i][j]>=10)cerr<<"res:"<<G[i][j]<<'\n';
				++ans[G[i][j]];
			}
		//cerr<<"edge: "<<cntedge<<'\n';
	}
}
void Inspect(int R) {
    Solve::build_Tree();
    Solve::check_Edge();
    Solve::Floyd();
    for(int i=1;i<=R;++i){
//    	cerr<<"ans "<<i<<':'<<Solve::ans[i]<<'\n';
    	Answer(i,Solve::ans[i]);
	}
}
